import request from '@/config/axios'

import { BaseModel } from '@/api/common/baseModel'

export interface Model extends BaseModel {
  code: string
  remark: string
  createTime?: Date
}

// 查询岗位列表
export const getPostPage = async (params: PageParam) => {
  return await request.get({ url: import.meta.env.VITE_BASE_ROLE + '/userCenter/dept/post/page.json', params })
}

// 获取岗位精简信息列表
export const getList = async (): Promise<Model[]> => {
  return await request.get({ url: import.meta.env.VITE_BASE_ROLE + '/userCenter/dept/post/arr.json' })
}

// 查询岗位详情
export const getById = async (id: string) => {
  return await request.get({ url: import.meta.env.VITE_BASE_ROLE + '/userCenter/dept/post/getById.json?id=' + id })
}

// 修改岗位
export const update = async (data: Model) => {
  return await request.put({ url: import.meta.env.VITE_BASE_ROLE + '/userCenter/dept/post/update.json', data })
}

// 删除岗位
export const del = async (id: string) => {
  return await request.delete({ url: import.meta.env.VITE_BASE_ROLE + '/userCenter/dept/post/del.json?id=' + id })
}
